package flag

import (
	"flag"
)

// CmdFlags 用于保存命令行参数
type CmdFlags struct {
	ParseHost         bool
	ParseService      bool
	ParseServiceURL   bool
	RegisterServices  bool
	RegisterHost      bool // 新增标志
	RegisterIcmp      bool
	//RegisterTelegraf  bool
	RegisterInterface bool
	RegisterService   bool
}

// Parse 解析命令行参数
func Parse() CmdFlags {
	var cmdFlags CmdFlags

	flag.BoolVar(&cmdFlags.ParseHost, "parseHost", false, "Parse hosts from XLSX and convert to YAML")
	flag.BoolVar(&cmdFlags.ParseService, "parseService", false, "Parse services from XLSX and convert to YAML")
	flag.BoolVar(&cmdFlags.ParseServiceURL, "parseServiceURL", false, "Parse service URLs from XLSX and convert to YAML")
	flag.BoolVar(&cmdFlags.RegisterServices, "registerServices", false, "Register all services to Consul")
	flag.BoolVar(&cmdFlags.RegisterHost, "registerHost", false, "Register Host function to Consul")                // 新增解析
	flag.BoolVar(&cmdFlags.RegisterIcmp, "registerIcmp", false, "Register icmp function to Consul")                // 新增解析
	//flag.BoolVar(&cmdFlags.RegisterTelegraf, "registerTelegraf", false, "Register telegraf function to Consul")    // 新增解析
	flag.BoolVar(&cmdFlags.RegisterInterface, "registerInterface", false, "Register interface function to Consul") // 新增解析
	flag.BoolVar(&cmdFlags.RegisterService, "registerService", false, "Register service_tcp function to Consul")   // 新增解析

	flag.Parse()

	return cmdFlags
}
